package com.lnsoft.cac.client.test.nettyClient;


import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.IdleStateEvent;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class HeartBeatClientHandle extends ChannelInboundHandlerAdapter {
//    @Override
//    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
//        log.warn("heartBeat#userEventTriggered被调用:evt:{}", evt);
//
//        if (evt instanceof IdleStateEvent) {
//            Channel channel = ctx.channel();
//            ClientDevice clientDevice = NettyClient.deviceMap.get(channel);
//            ctx.writeAndFlush(FrameFactory.heartSendFrame(clientDevice.clientName, clientDevice.frameNum + 1));
//            clientDevice.frameNum += 1;
//            log.warn(MessageUtil.addColour("心跳帧  >>>  发送完成:" + new String(clientDevice.clientName) + ":" + channel));
//        }
//        super.userEventTriggered(ctx, evt);
//    }
}

